import 'package:algorand_dart/algorand_dart.dart';
import 'package:convert/convert.dart';

void main() async {
  final creator = '';
  final assetId = 166552124;

  final options = AlgorandOptions();

  final algorand = Algorand(options: options);

  final seed = hex.decode(
      'c802e0424ee04151c0aafeae335ef79c45e3d06b51b1c69dae160c2f96271b6a');

  final account = await Account.fromSeed(seed);
  print(account.publicAddress);
  print(account.address.encodedAddress);

  try {
    final tx = await algorand.createAssetTransferTransaction(
      sender: account.address,
      assetId: assetId,
    );

    final signedTx = await tx.sign(account);
    final txId = await algorand.sendTransaction(signedTx);
    final pendingTx = await algorand.waitForConfirmation(txId);

    print(pendingTx);
  } on AlgorandException catch (ex) {
    print(ex);
  }
}
